package com.basic.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 登录控制器
 * @Author: wisdomwang
 * @Date: 2019-05-23 14:40
 **/
@RestController
public class LoginController {

    @Value("${auth}")
    private String auth;

    @GetMapping("/")
    public String root(){
        return "redirect:/index";
    }

    @GetMapping("/index")
    public String index(){
        return "index";
    }

    @GetMapping("/user/index")
    public String userIndex(){
        return "user/index";
    }

    @GetMapping("/login-error")
    public String loginError(Model model){
        model.addAttribute("loginError",true);
        return "login";
    }

    @GetMapping("/401")
    public String accessDenied(){
        return "401";
    }

    @GetMapping("/auth")
    public String auth(){
        return auth;
    }


}
